package com.example.demo.config

import org.springframework.web.servlet.config.annotation.CorsRegistry
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer

/**
 * 跨域问题处理类
 */
class CorsConfiguration  : WebMvcConfigurer{
    override fun addCorsMappings(registry: CorsRegistry) {
        registry.addMapping("/**")
            .allowCredentials(true)
                .allowedMethods("GET","POST","DELETE","OPTIONS","PUT")
            .allowedOriginPatterns("*")
            .allowedHeaders("*")
            .exposedHeaders("*")
    }
}